<template>
    <el-row>
        <el-col class="btn">
            <el-dialog :visible.sync="dialogVisible" width="625px" :before-close="handleClose" @close="handleClose()">
                <div slot="title" class="dialog-title box box-align-center">
                    <i class="title-icon"></i>
                    <span class="title-text ml10">{{title}}</span>
                </div>
                <el-form ref="form" :model="form" label-width="80px" class="reset-form">
                    <el-input class="reset-input w100" placeholder="搜索教师姓名或教职工号" v-model="form.searchText">
                        <i slot="suffix" class="el-input__icon el-icon-search cp" @click="xxlb()"></i>
                    </el-input>
                </el-form>
                <div class="user-list radio">
                    <el-col class="box box-pack-center ml30">
                        <div class="list box box-align-center">
                            <span class="item">姓名</span>
                            <span class="item">教职工号</span>
                            <span class="item">手机号</span>
                        </div>
                    </el-col>
                    <el-radio-group v-model="form.resource">
                        <el-radio label="线上品牌商赞助" v-for="city in cities" :label="city" :key="city">
                            <div class="list box box-align-center">
                                <span class="item">吴老师</span>
                                <span class="item">2545465456465481</span>
                                <span class="item">44554545</span>
                            </div>
                        </el-radio>
                    </el-radio-group>
                </div>
                <span slot="footer" class="dialog-footer">
                    <el-button class="reset-cancel-btn" @click="handleClose()">取 消</el-button>
                    <el-button class="reset-comfirm-btn" @click="onSubmit()">保 存</el-button>
                </span>
            </el-dialog>
        </el-col>
    </el-row>
</template>

<script>
    const cityOptions = ['上海', '北京', '广州', '深圳'];
    export default {
        props: {
            dialogVisible: {
                default: false
            },
            title: {
                default: '添加负责人'
            },
            info: {

            }
        },
        data() {
            return {
                form: {
                    searchText: '',
                    radio: ''
                },
                checkedCities: [],
                cities: cityOptions,
                isIndeterminate: true
            };
        },
        mounted() {},
        methods: {
            updateInfo() {
                this.$nextTick(() => {
                    if (this.title == '修改学校') {
                        this.endTime = this.formatDate(new Date(this.info.endTime)),
                            this.form.id = this.info.id,
                            this.form.name = this.info.name,
                            this.form.logo = this.info.logo,
                            this.form.address = this.info.address,
                            this.form.tel = this.info.tel
                    } else {
                        this.form = {
                            id: '',
                            name: '',
                            logo: '',
                            address: '',
                            tel: '',
                            serverTime: ''
                        }
                    }

                })

            },
            handleClose() {
                this.$emit('closeZz')
            },
            onSubmit() {
                var params = {
                    'id': this.form.id,
                    'name': this.form.name,
                    'logo': this.form.logo,
                    'address': this.form.address,
                    'tel': this.form.tel,
                    'serverDate': this.endTime,
                    'createUser': this.$store.getters.getUser.userCode
                };
                this.$api.sxxgl.tjxx(params).then(res => {
                    if (res.code == '0') {
                        this.handleClose()
                        this.$message.success('操作成功！');
                        this.$emit('updateList')
                    } else {
                        this.$message.error('操作失败！');
                    }
                })
            },
            handleCheckedCitiesChange(value) {
                let checkedCount = value.length;
                this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
                console.log(this.checkedCities);
            }
        }
    };
</script>

<style scoped lang="scss">
    .upload-icon {
        width: 110px;
        height: 110px;
        background-color: #F0F1F8;
        line-height: 110px;
        color: #626BF1;
        font-size: 30px;
        border-radius: 10px;
    }

    .avatar {
        width: 110px;
        height: 110px;
    }

    .w100 {
        width: 100%;
    }

    .reset-form {
        padding: 0 20px;
    }


    .user-list {

        .checkbox__label {
            width: 80%;
        }

        .list {
            padding: 10px 0;
        }

        .item {
            display: block;
            width: 120px;
            margin-right: 30px;
        }
    }


    //单选
    .user-list>>>.el-radio {
        padding: 0 20px;
        width: 585px;
        margin-right: 0;
        display: flex;
        justify-content: center;
    }

    .user-list>>>.el-radio__input {
        display: flex;
        align-items: center;
    }

    .user-list>>>.el-radio__input.is-checked+.el-radio__label {
        color: #000000;
    }

    .user-list>>>.el-radio__input.is-checked .el-radio__inner {
        border-color: #626BF1;
        background: #626BF1;
    }
</style>
